<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <script type="text/javascript">
    	  
    </script>
  </head>
  
  <body>
    <div class="x-body">
        <form class="layui-form" action='' method="post"> 
        	  <input type="hidden" class="id" value="{$employee.id}" name="id"/>
	          <div class="layui-form-item">
	              <label for="phone" class="layui-form-label">
	                  <span class="x-red">*</span>员工姓名
	              </label>
	              <div class="layui-input-inline">
	                  <input type="text" id="phone" name="true_name" required="" lay-verify="required"
	                  autocomplete="off" class="layui-input" value="{$employee.true_name}">
	              </div>
	          </div>
	          <div class="layui-form-item">
		          <label for="username" class="layui-form-label">
		              <span class="x-red">*</span>性别
		          </label>
		          <div class="layui-input-inline" id="foodsspec">
		          	   {eq name="employee.sex" value="男"}
		          	   <input type="radio" name="sex" value="0" checked="checked"/>男
		          	   <input type="radio" name="sex" value="1"/>女
		          	   {else/}
		          	   <input type="radio" name="sex" value="0"/>男
		          	   <input type="radio" name="sex" value="1" checked="checked"/>女
		          	   {/eq}
		          </div>
	          </div>
	          <div class="layui-form-item">
	              <label for="username" class="layui-form-label">
	                  <span class="x-red">*</span>电话
	              </label>
	              <div class="layui-input-inline">
	                  <input type="text" id="username" name="phone" required="" lay-verify="required"
	                  autocomplete="off" class="layui-input" value="{$employee.phone}">
	              </div>
	          </div>
	          <div class="layui-form-item">
	              <label for="username" class="layui-form-label">
	                  <span class="x-red">*</span>身份
	              </label>
	              <div class="layui-input-inline">
	              	  <select name="status">
	              	  	 {eq name="$employee.status" value="服务员"}
	              	  	     <option value="2">服务员</option>
	              	  	     <option value="3">厨师</option>
	              	  	     {else/}
	              	  	     <option value="3">厨师</option>
	              	  	     <option value="2">服务员</option>
	              	  	 {/eq}
	              	  	 <option></option>
	              	  </select>
	              </div>
	          </div>
	          <div class="layui-form-item">
	              <label for="L_repass" class="layui-form-label">
	              </label>
	              <button class="layui-btn" lay-filter="add" lay-submit="">
                        	保存
                    </button>
	          </div>
      </form>
    </div>
    <script>
    	layui.use(['layer','form'], function(){
    		var layer = layui.layer
    			,form = layui.form;
    			form.on('submit(add)',function(data){
    				console.log(data.field);
                   $.post('{:url("Employee/waiter_edit")}',data.field,function(res){
                   	   console.log(res);
                   	   if(res==true){
                   	   	    layer.alert("保存成功", {icon: 6}, function () {
		                        window.parent.location.reload();
		                        var index = parent.layer.getFrameIndex(window.name);
		                        parent.layer.close(index);
		                    });
                   	   }else{
                   	   	    layer.alert("保存失败", {icon: 6}, function () {
		                        window.parent.location.reload();
		                        var index = parent.layer.getFrameIndex(window.name);
		                        parent.layer.close(index);
		                    });
                   	   }
                   });
                    return false;
    			});
    	});
        
    </script>
  </body>

</html>

